#!/bin/sh

SRC_ROOT=`pwd`
OUT_ROOT=${SRC_ROOT}/make
DST_ROOT=${OUT_ROOT}/Debug

prepare() {

local CFG=$(echo $1 | tr '[:lower:]' '[:upper:]')
local DST_ROOT=${OUT_ROOT}/${1}

#echo ${CFG}
#echo ${DST_ROOT}

if [ ! -d ${DST_ROOT} ]; then

if [ ! -d ${OUT_ROOT} ]; then
    mkdir ${OUT_ROOT}
fi

    echo Making new directory [${DST_ROOT}]
    mkdir ${DST_ROOT}
fi

cd ${DST_ROOT}

echo Executing CMake
cmake -G "Unix Makefiles" -D CMAKE_BUILT_TYPE:String=${CFG} ${SRC_ROOT}

} # prepare()

prepare Debug
prepare Release

